package com.yoomiito.app.widget.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import com.yoomiito.app.R
import com.yoomiito.app.base.BaseActivity
import com.yoomiito.app.utils.ColorUtils
import com.yoomiito.app.utils.DensityUtil
import com.yoomiito.app.utils.RouterUtils

/**
 * 免费领取赠品
 */
class GetFreeGoodsTipDialog(mContext:Context):BaseDialog(mContext, R.style.dialog_2) {
    override fun setView(): View {
        val view = LayoutInflater.from(mContext).inflate(R.layout.dialog_get_free_goods_tip,null,false)
        view.findViewById<TextView>(R.id.know).setOnClickListener { dismiss() }
        view.findViewById<TextView>(R.id.getFreeGoods).let{
            it.background = ColorUtils.gradientAndRadius("#FFFF035B","#FFFF246C",DensityUtil.dp2px(20f).toFloat())
            it.setOnClickListener {
                RouterUtils.toMain(mContext as BaseActivity<*>,1)
                (mContext as BaseActivity<*>).finish()
            }
        }

        setWidthPercent(0.78)
        setmHeightPercent(0.53)
        setCanceledOnTouchOutside(true)
        return view
    }

}